#include <iostream>
using namespace std;

class MyClass {
  public:
    MyClass() { count++; }
    ~MyClass() { count--; }
    static int GetCount() { return count; }

  private:
    static int count;
};

int MyClass::count = 0;

int main() {
    MyClass obj1;
    cout << MyClass::GetCount() << endl;
    MyClass obj2;
    cout << MyClass::GetCount() << endl;
    MyClass obj3;
    cout << obj1.GetCount() << endl;
    MyClass *p = new MyClass;
    cout << MyClass::GetCount() << endl;
    delete p;
    cout << MyClass::GetCount() << endl;

    return 0;
}
